
import React from 'react';
import cass from 'classnames';
import s from './index.module.less';
import Avatar from '../Avatar';

export default function UserItem({ username, headimage, active, onClick, extra, style, replaceFun }) {
    return (
        <div className={cass(s.item, 'hovergray', { [s.active]: active })} onClick={onClick || null} style={style}>
            <Avatar
                username={username}
                headimage={headimage}
                // color={'userColor'}
                // borderColor={'userBorderColor'}
            />
            <div
                className={s.text}
                dangerouslySetInnerHTML={replaceFun ? { __html: replaceFun(username) } : undefined}
            >
                {replaceFun ? null : (username || '未知')}
            </div>
            {extra ? <div className={s.right}>{extra}</div> : null}
        </div>
    )

}